package com.grsu.phonestation.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.grsu.phonestation.dao.impl.SubscribeDAOImpl;
import com.grsu.phonestation.domain.Client;
import com.grsu.phonestation.domain.Subscribe;
import com.grsu.phonestation.service.SubscribeService;

@Service
@Transactional
public class SubscribeServiceImpl implements SubscribeService {

	@Autowired
	private SubscribeDAOImpl subscribeDAO;

	@Override
	public void addSubscribe(Subscribe subscribe) {
		subscribeDAO.save(subscribe);

	}

	@Override
	public void removeSubscribe(int subskribeId) {
		subscribeDAO.remove(subskribeId);

	}

	@Override
	public List<Subscribe> getSubscribeServiceClient(Client client) {
		List<Subscribe> subscribeService = subscribeDAO
				.getSubscribeServiceClient(client);
		return subscribeService;

	}

	@Override
	public List<Subscribe> listSubscribees() {
		List<Subscribe> subscribes = subscribeDAO.findAll();
		return subscribes;
	}
	
	@Override
	public List<Subscribe> getSubscribeSearchUser(String user){
		List<Subscribe> subscribes = subscribeDAO.getSubscribeSearchUser(user);
		return subscribes;
	}

}
